import java.util.HashSet;
//要实现没有重复元素的HashSet，需要重写 equals()方法 和 hashCode()方法，自动生成即可
public class HashSetDemo {
    public static void main(String[] args) {

        HashSet<Student> hs = new HashSet<>();
        Student s1 = new Student("Jack",25);
        Student s2 = new Student("Amy",22);
        Student s3 = new Student("Andy",27);
        Student s4 = new Student("Andy",27);
        hs.add(s1);
        hs.add(s2);
        hs.add(s3);
        hs.add(s4);

        System.out.println(hs.size());
        for(Student stu : hs){
            System.out.println(stu.getName() + " , " + stu.getAge());
        }
    }
}
